package controllers;

import play.api.mvc.Security;
import play.mvc.Http;
import play.mvc.Result;

/**
 * User: yeqingzhou
 * Date: 12-8-30
 */
public class SecuredUser extends play.mvc.Security.Authenticator {
    @Override
    public String getUsername(Http.Context ctx) {
        return ctx.session().get("email");
    }

    @Override
    public Result onUnauthorized(Http.Context ctx) {
        return redirect(routes.UserAuthController.login());
    }
}
